<?php


namespace App\Models\V1;


class Notice extends BaseModel
{

    protected $connection;
    protected $table = 'pr_notice';
    protected $fillable = ['id', 'title', 'content', 'state', 'notice_class_id', 'preparatory_id', 'community_id', 'community_name', 'preparatory_name'];


    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->connection = config('database.connections.preparatory.database');
    }



    public function noticeClass()
    {
        return $this->hasOne(NoticeClass::class, 'id', 'notice_class_id');
    }

    /**
     * 状态
     * @param $key
     * @return string
     */
    public function getStateAttribute($key)
    {
        return (string)$key;
    }

}
